<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/static/common/default.jsp"%>
<html>
	<head>
	    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<style type="text/css">
			.select_option{
				width: 180px;
				z-index: 1;
				position: absolute;
			}
			.select_showbox{
				width: 175px;
			}
		</style>
		<link type="text/css" rel="stylesheet" href="${ctx}/static/tools/jquery-validationEngine/validationEngine.jquery.css"></link>
	</head>
	<body>
		<script type="text/javascript" src="${ctx}/static/tools/jquery-validationEngine/jquery.validationEngine.js"></script>
		<script type="text/javascript" src="${ctx}/static/tools/jquery-validationEngine/jquery.validationEngine-cn.js"></script>
		<div class="cinema_tip">
		    <div class="cinema_subject clearfix">
		        <div class="cinema_title">
		            <a href="javascript:void(0);">项目管理</a> >
		            <a id="userinfo_list_href" href="${ctx}/sys/sysProjectMan/ProjectInfo/toSearch">项目信息</a> >
		            <a href="javascript:void(0);" class="cinema_option">编辑项目信息</a>
		        </div>
		        <!-- <a onclick="javascript:history.back(-1);" class="movie_return">返回列表</a> -->
		        <a href="${ctx}/sys/sysProjectMan/ProjectInfo/toSearch" class="movie_return">返回列表</a>
		    </div>
		</div>
		<div class="cinema_list">
			<form class="form-horizontal" onsubmit="return sysProInfoModify();" id="sysProInfo"  name="sysProInfoModifyForm" >
				<input type="hidden" id="proId" name="proId" value="${sysProInfo.proId}">
				<div class="movie_list">
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p>项目编号：</p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed">
								<input id="proCode" type="text" name="proCode" value="${sysProInfo.proCode}" class="validate[required,maxSize[100]]" maxlength="100" />
							</div>
						</dd>
					</dl>
					<div class="clearfix"></div>
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p>项目名称：</p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed">
								<input id="name" type="text" name="name" value="${sysProInfo.name}" class="validate[required,maxSize[50]]" maxlength="50" />
							</div>
						</dd>
					</dl>
					<div class="clearfix"></div>
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p style="background-image: none;">项目经理：</p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed">
								<input id="manager" type="text" name="manager" value="${sysProInfo.manager}" class="width_320" maxlength="100" />
							</div>
						</dd>
					</dl>
					
					<div class="clearfix"></div>
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p>物资部负责人：</p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed">
								<input id="wzbUserName" type="text" name="wzbUserName" value="${sysProInfo.wzbUserName}" class="validate[required,maxSize[100]]" maxlength="100" />
							</div>
						</dd>
					</dl>
					
					<div class="clearfix"></div>
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p>合同部负责人：</p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed">
								<input id="htbUserName" type="text" name="htbUserName" value="${sysProInfo.wzbUserName}" class="validate[required,maxSize[100]]" maxlength="100" />
							</div>
						</dd>
					</dl>
					
					<div class="clearfix"></div>
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p style="background-image: none;">项目所在地：</p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed">
								<input id="district" type="text" name="district" value="${sysProInfo.district}" class="width_320" maxlength="50" />
							</div>
						</dd>
					</dl>
					<div class="clearfix"></div>
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p style="background-image: none;">项目状态: </p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed positionSelect">
								<select id="status" name="status">
									<option class="department_opt" value="">选择项目状态</option>
										<option class="department_opt" value="1" <c:if test="${sysProInfo.status ==1}">selected</c:if>>未开工</option>
										<option class="department_opt" value="2" <c:if test="${sysProInfo.status ==2}">selected</c:if>>已开工</option>
										<option class="department_opt" value="3" <c:if test="${sysProInfo.status ==3}">selected</c:if>>已完工</option>
								</select>
							</div>
						</dd>
					</dl>
					<div class="clearfix"></div>
					<a class="movie_continue">
						<input type="submit" name="submit" id="submit" value="提交" class="cinema_inquiry" />
					</a>
				</div>
			</form>
		</div>
		<script type="text/javascript">
			//项目基本信息修改
			function sysProInfoModify(){
				 if($("#sysProInfoModifyForm").validationEngine("validate")){
					 
					 var datastr = new Object();
					 	datastr.proId = $('#proId').val();
		    			datastr.name = $('#name').val();
		    			datastr.proCode = $('#proCode').val();
		    			datastr.manager = $('#manager').val();
		    			datastr.district = $('#district').val();
		    			datastr.wzbUserName = $('#wzbUserName').val();
		    			datastr.htbUserName = $('#htbUserName').val();
		    			datastr.status = $('#status').val();
						var result = true;
						$.ajax({
		    		        async: true,
		    		        type:"POST",
		    		        data:JSON.stringify(datastr),
		    		        url: "${ctx}/sys/sysProjectMan/ProjectInfo/modify?&mid="+Math.random(),
		    		        dataType: "json",
		    		        headers : {  
		                        'Content-Type' : 'application/json;charset=utf-8'  
		                    },
		                    
		                    success : function(data) {
		                		if (data != undefined && data.status != undefined
		                				&& data.status.trim() == '0') {
		                			result = true;
		                			alert("修改成功！");
		                			window.location.href = "${ctx}/sys/sysProjectMan/ProjectInfo/toSearch";
		                		} else {
		                			result = false;
		                			alert(data.error);
		                		}
		                	},
		    			},"json");
					 
				}
				return false; 
				/*var aa = new Object();
				aa.proId = $("#proId").val();
				alert($("#proId").val());
				$.ajax({  
					        type : 'POST',  
					        contentType : 'application/json',  
					        url : '${ctx}/sys/sysProjectMan/ProjectInfo/modify',  
					        dataType : 'json',  
					        data :  {"name":"Jack"},
					        success : function(data) {  
					            alert("id: " + data.id + "\nname: " + data.name + "\nstatus: "  
					                    + data.status);  
					        },  
					        error : function() {  
					            alert('Err...');  
					        }  
					    }); */
			}
			$("#sysUserInfoModifyForm").validationEngine();
		</script>
	</body>
</html>